package com.shuangfeidasan.service.ums.impl;

import com.shuangfeidasan.model.ums.UmsRolePermissionRelation;
import com.shuangfeidasan.mapper.ums.UmsRolePermissionRelationMapper;
import com.shuangfeidasan.service.ums.UmsRolePermissionRelationService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description 后台角色权限关系表(UmsRolePermissionRelation)表服务实现类
 * @Author JunWEI
 * @Date 2022-02-28 14:30:34
 */
@Service("umsRolePermissionRelationService")
public class UmsRolePermissionRelationServiceImpl implements UmsRolePermissionRelationService {
    @Resource
    private UmsRolePermissionRelationMapper umsRolePermissionRelationMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public UmsRolePermissionRelation queryById(Long id) {
        return this.umsRolePermissionRelationMapper.queryById(id);
    }

    /**
     * 查询指定行
     *
     * @param umsRolePermissionRelation 筛选条件
     * @return 查询结果
     */
    @Override
    public List<UmsRolePermissionRelation> queryAll(UmsRolePermissionRelation umsRolePermissionRelation) {
        return this.umsRolePermissionRelationMapper.queryAll(umsRolePermissionRelation);
    }

    /**
     * 新增数据
     *
     * @param umsRolePermissionRelation 实例对象
     * @return 实例对象
     */
    @Override
    public UmsRolePermissionRelation insert(UmsRolePermissionRelation umsRolePermissionRelation) {
        this.umsRolePermissionRelationMapper.insert(umsRolePermissionRelation);
        return umsRolePermissionRelation;
    }

    /**
     * 修改数据
     *
     * @param umsRolePermissionRelation 实例对象
     * @return 实例对象
     */
    @Override
    public UmsRolePermissionRelation update(UmsRolePermissionRelation umsRolePermissionRelation) {
        this.umsRolePermissionRelationMapper.update(umsRolePermissionRelation);
        return this.queryById(umsRolePermissionRelation.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.umsRolePermissionRelationMapper.deleteById(id) > 0;
    }
}
